package cn.itcast.util;

import org.apache.commons.lang3.time.DateUtils;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class MyDateUtil {
    public static List<Date> getDates(Date date) {
        List<Date> dateList = new ArrayList<>();
        for (int i = 0; i < 24; i++) {
            Date d = DateUtils.addHours(date, i);
            dateList.add(d);
        }
        return dateList;
    }

    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.HOUR_OF_DAY,0);
        calendar.set(Calendar.MINUTE,0);
        calendar.set(Calendar.SECOND,0);
        List<Date> dateList = getDates(calendar.getTime());
        dateList.forEach(date -> {
            System.out.println(date);
        });
    }
}
